function [tim,ks,kx,ky,corfac,delt] = rosette(Tr,Tc,Tacq,reso,fov,Gmax,S);

Gmax=5;S=50000;

gam=4258;coex=-2i*pi;
delt=(1/fov)/(gam*Gmax), Ns=round(Tacq/delt);
tim=(1:Ns)*delt;kf=reso/(2*fov);
ks=kf*sin(2*pi*tim/Tr).*exp(2i*pi*tim/Tc);
gs=diff(ks)/(gam*delt);Gmaxact=max(abs(real(gs)))
2*pi*kf*max(1/Tr,1/Tc)/gam
% Now that Gmax has been determined, recompute actual max sample interval
% delt, and new arrays for ks and gs based on actual sampling frequency:
delt=(1/fov)/(gam*Gmaxact), Nss=floor(Tacq/delt);
tim=(1:Nss)*delt;
ks=kf*sin(2*pi*tim/Tr).*exp(2i*pi*tim/Tc);
% max abs derivative is actually 2pi*kf*max(1/Tr,1/Tc) if I have the
% scaling right
gs=diff(ks)/(gam*delt);
kx=real(ks);ky=imag(ks);
%nkx=floor(65+63.5*kx(1:16000)/kf);
%nky=floor(65+63.5*ky(1:16000)/kf);
kr=abs(ks);
corfac=(kr./kf).*sqrt(1-(kr./kf).^2);% correction factors for ideal sampling density